//
//  GetData.m
//  Love_House
//
//  Created by LTJ on 14-10-15.
//  Copyright (c) 2014年 七月. All rights reserved.
//

#import "GetData.h"

#import "AFNetworking.h"

@implementation GetData

-(void)getDataURL:(NSString *)url dic:(NSDictionary *)dic block:(MyBlock)block
{
    AFHTTPRequestOperationManager * manager = [AFHTTPRequestOperationManager manager];
    //解密http 遇到这种加密方式就解密
    manager.securityPolicy.allowInvalidCertificates = YES;
    //遇到以下格式返回  json 序列号
    [manager.responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"text/json",@"application/json",@"text/jacascript",@"text/html",@"text/css",@"text/plain", nil]];
    [manager GET:url parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        self.block = block;
        self.block(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@", error);
    
        self.block(@"error");
        
    }];
    
}

@end
